<%-- 
    Document   : Search
    Created on : Dec 19, 2014, 9:46:55 AM
    Author     : thanh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1 >Welcome , <font color="red"><c:out value="${sessionScope.User}"/></font></h1>
        <form action="ControllerServlet" method="post">
            Name : <input type="text" name="txtSearch"/>
            <input type ="submit" name="action" value="Search"/>
        </form>
        <h1>Search result</h1>
        <table border="1">
            <thead>
                <tr>
                    <th>No</th>
                    <th>Username</th>
                    <th>Lastname</th>
                    <th>IsAdmin</th>
                    <th>Action</th>
                </tr>
            </thead>
            <tbody>
                <c:forEach items="${requestScope.Info}" var="regis" varStatus="regisStatus">
                    <tr>
                        <td>${regisStatus.count}</td>
                        <td>${regis.username}</td><!user name của dto>
                        <td>${regis.lastname}</td>
                        <td><input type="checkbox" <c:if test="${regis.isAdmin}">checked</c:if></td>
                        <td>
                            <form action="ControllerServlet" method="post">
                                <input type="hidden" value="${regis.username}" name="txtUsername"/>
                            <input type="submit" name="action" value="Delete"/>
                            <input type="submit" name="action" value="Update"/>
                            </form>
                        </td>
                    </tr>
                </c:forEach>
            </tbody>
        </table>

    </body>
</html>
